package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Description mapper类
 * @Author songyu
 * @Date 2024-07-05
 */
@Mapper
public interface NursingProjectMapper {


    /**
     * 条件查询护理项目数据列表
     * 注意：中州养老里面的mybatis有点冲突，接口方法多个参数必须起别名
     * @param name
     * @param status
     * @return
     */
    Page<NursingProjectVo> selectByPage(@Param("name") String name,
                                        @Param("status") Integer status);

    /**
     * 插入护理项目
     * @param nursingProject
     */
    void insert(NursingProject nursingProject);

    /**
     * 根据id查询护理项目
     * @param id
     * @return
     */
    NursingProject getById(Long id);

    /**
     * 修改护理项目
     * @param nursingProject
     */
    void update(NursingProject nursingProject);

    @Update("update nursing_project set status = #{status} where id = #{id}")
    void isEnable(Long id, Integer status);

    int deleteById(long id);

    @Select("select * from nursing_project")
    List<NursingProjectVo> selectAll();
}